#include <stdio.h>

int main()
{
    int nCase;
    scanf("%d", &nCase);
    while (nCase-- > 0)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        if (b == 0)
            printf("UNKNOWN\n");
        else if (a % b == 0)
            printf("YES\n");
        else 
            printf("NO\n");
    }
    return 0;
}
